import { Booking } from '../../booking/entities/booking.entity';
import {
  Column,
  CreateDateColumn,
  Entity,
  OneToMany,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
} from 'typeorm';

@Entity({ name: 'meetingRoom' })
export class MeetingRoom {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ comment: '会议室名称', length: 50 })
  name: string;

  @Column({ comment: '会议室容量' })
  capacity: number;

  @Column({ comment: '会议室位置', length: 100 })
  location: string;

  @Column({ comment: '设备', length: 50, default: '' })
  equipment: string;

  @Column({ comment: '描述', length: 100, default: '' })
  description: string;

  @Column({ comment: '是否被预定', default: false })
  isBooked: boolean;

  @OneToMany(() => Booking, (booking) => booking.room)
  bookings: Booking[];

  @CreateDateColumn({ comment: '创建时间' })
  createTime: Date;

  @UpdateDateColumn({ comment: '更新时间' })
  updateTime: Date;
}
